<script type="text/javascript">
var dataOptions = new Object();
$(function(){	
	//$("#empNoByStorageCancel").val("10000000");
	//$("#branchNoByStorageCancel").val("10000000");
	$.post("inventorymanagement/getUserAndBanch",function(json){
		var activeUser = json.activeUser;
		var userNo=activeUser.userNo;
		var branchNo=activeUser.branchNo;
		$("input[name='employeeNo']").val(userNo);
		$("input[name='branchNo']").val(branchNo);
		var param = new Object();
		param.employeeNo = $("#empNoByStorageCancel").val();
		param.branchNo = $("#branchNoByStorageCancel").val();
		console.log("param-====>"+param);
		$.post("inventoryMagOfIncomingCancel/getStorageCancel",param,getStorageCancel,"json");
})
	$.get("parameterCard/getCardInfo",function(data){
		var contentb="<option value='' selected>请选择</option>";
		var html_cardTCode = data.cardTypeCode;
		var html_cardpCode = data.cardpCode;
		var currentPage = data.currentPage;
		var numPerPage = data.numPerPage;
		var pageCount = data.pageCount;
		if(currentPage&&numPerPage&&pageCount){
			dataOptions["currentPage"]=currentPage;
			dataOptions["numPerPage"]=numPerPage;
			dataOptions["pageCount"]=pageCount;
		}
		if(html_cardpCode){
			contentb="<option value=''>请选择</option>";
			dataOptions["cardpCode"]= html_cardpCode;
		}
		var i;
		$(data).each(function(n,item){
			for(i=0;i<item.cdProDefinitions.length;i++){
				if(item.cdProDefinitions[i].cardpCode==item.cardpCode){
					contentb+="<option value="+item.cdProDefinitions[i].cardpCode+" selected>"
					+item.cdProDefinitions[i].cardpName+"</option>"
				}else{
					contentb+="<option value="+item.cdProDefinitions[i].cardpCode+">"
					+item.cdProDefinitions[i].cardpName+"</option>"
				}
			}
			//全选按钮初始化，如果之前选中了，清除
			$("#cardpCodeBySorCan").html(contentb);
			
		});
	},"json");
	
	//出入库模式信息加载
	$.get("inventorymanagement/getStorageModeInfo",{storageModeType:0},function(data){
		var contentb="<option value='' selected>请选择</option>";
		var list = data.storageModeInfo;
		for(var i=0;i<list.length;i++){
			console.log("lsit==>"+list[i].storageModeId);
			contentb+="<option value="+list[i].storageModeId+">"
			+list[i].storageModeDesc+"</option>"
		}
			
		
			//全选按钮初始化，如果之前选中了，清除
			$("#storageModeBySC").html(contentb);
		});
	
	//验证输入框的有效性
	$("#queryStorageIncomingHistory").click(function(){
		var storageNo = $("#storageNoBySc").val();
		console.log("storageNo===>"+storageNo);
		var storageModeBySC = $("#storageModeBySC").val();
		console.log("storageModeBySC===>"+storageModeBySC);
		var storageDateFrom = $("input[name='storageDateFrom']").val();
		console.log("storageDateFrom===>"+storageDateFrom);
		var storageDateTo = $("input[name='storageDateTo']").val();
		console.log("storageDateTo===>"+storageDateTo);
		
		if(storageNo){
			var length = storageNo.length;
			if(length!=8){
				alertMsg.warn("【入库流水号】请输入长度为8位！")
				return false;
			}else{
				if(!/^\d{8}\b/.test(storageNo)){
					alertMsg.warn("【入库流水号】请输入8位数字！")
					return false;
				}
			}
		}
		
		/* //如果日期起不为空，则检查日期有效
		if(storageDateFrom){
			if(!checkDate(storageDateFrom)){
				alertMsg.warn("请输入8位正确的日期！")
				return false;
			}
		}
		//如果日期止不为空，则检查日期有效
		if(storageDateTo){
			if(!checkDate(storageDateTo)){
				alertMsg.warn("请输入8位正确的日期！")
				return false;
			}
		}*/
		//如果两者都不为空，判断日期大小
		if(storageDateFrom && storageDateTo){
			var dateFrom = new Date(storageDateFrom);
			var dateTo =new Date(storageDateTo);
			if(dateFrom>dateTo){
				alertMsg.warn("起始日期不能大于终止日期！")
				return false;
			}
		} 
		$("input[name='pageNum']").val("1");
		console.log("pageNum==>"+$("input[name='pageNum']").val());
		
	});
	
	
	})
//检查日期
/* function checkDate(dateObj){
	var dateFlag;
	console.log("日期===>"+dateObj);
	if(dateObj.length!=8){
		return false;
	}else{
		var year = dateObj.substr(0,4);
		var month = dateObj.substr(4,2);
		var day = dateObj.substr(6,2);
		var createDate = new Date(year+'/'+month+'/'+day);
		var dateFlag ;
		if(createDate.getFullYear() == year && (createDate.getMonth() + 1) == month && createDate.getDate() == day){
			dateFlag = true;
		}else{
			dateFlag = false;
		}
		return dateFlag;
	}
} */

function validateCheckBoxSC(){	 
	
	if($("input[name='StorageCanceled']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")	
		 return false;
	}
}
</script>	



<div class="pageHeader ">

	<form id="pagerForm" method="post" action="inventoryMagOfIncomingCancel/getStorageCancel" class="pageForm required-validate" onsubmit="return validateCallback(this,getStorageCancel);">

		<input type="hidden" name="pageNum" value="" /> 
		<input type="hidden" name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<!-- <input type="hidden" name="orderField" value="${param.orderField}" />
		<input type="hidden" name="orderDirection" value="${param.orderDirection}" /> -->
		<div class="searchBar">
		<div class="row" style="padding: 0 10px;">
				<div class="col-md-4 col-sm-12">
					<p>
						<label>入库流水号：</label>
				<input name="storageNoByAlpha" value="KC" readonly="readonly" style="width:30px;"> - <input id="storageNoBySc" name="storageNo"  style="width:104px;">
					</p>
				</div>
				<div class="col-md-4 col-sm-12">
					<p>
						<label>入库方式：</label>
				<select  id="storageModeBySC" name="storageModeBySC" >
				</select>
					</p>
				</div>
			</div>
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-4 col-sm-12">
					<p>
					<label>入库日期(起)：</label>
				<input id="storagedate" name="storageDateFrom" class="date validDateFrom" />
					</p>
				</div>
				<div class="col-md-4 col-sm-12">
					<p>
						<label>入库日期(止)：</label>
				<input id="storagedate1" name="storageDateTo" class="date validDateTo"/>
					</p>
				</div>
			</div>
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-4 col-sm-12">
					<p>
						<label>网点编号：</label>
				<input type="text" id="branchNoByStorageCancel" name="branchNo" value="" readonly="readonly"/>
					</p>
				</div>
				<div class="col-md-4 col-sm-12">
					<p>
						<label>员工编号：</label>
				<input type="text" id="empNoByStorageCancel" name="employeeNo" value="" readonly="readonly"/>
					</p>
				</div>
			</div>		
		<div class="subBar">
			<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="queryStorageIncomingHistory" type="submit" onclick="changeDate">查询</button></div></div>
				</li>
			</ul>
		</div>
		</div>
	</form>	
</div>

<!-- <form method="post" action="inventorymanagement/goStorageCanRegister" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);" > -->
<form method="post" action="inventoryMagOfIncomingCancel/incomingCanceling" class="pageForm required-validate" onsubmit="return validateCallback(this,navTabAjaxDone);" >

		<!-- <input id="bankName" name="bankName" type="hidden" value="">
		<input id="companyName" name="companyName" type="hidden" value=""> -->

	 <div class="pageContent" >
<div id="storagecancel">
		<table class="table" width="600" layoutH="320">

			<thead>

				<tr>
					<th width="5%" align="center">选择</th>
					<th width="5%" align="center">序号</th>
					<th width="15%" align="center">入库流水号</th>
					<th width="15%" align="center">操作网点编号</th>
					<th width="15%" align="center">入库柜员编号</th>
					<th width="20%" align="center">入库方式</th>
					<th width="15%" align="center">入库日期</th>
                    <th width="10%" align="center">数量</th>
				</tr>

			</thead>

			<tbody id="StorageCance">
						

			</tbody>
			

		</table>
</div>
	 <div class="panelBar">

		<div class="pages">

			<span>显示</span>

			<select class="combox" id="numPerPageByIM" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'StorageCance',getStorageCancel)">

				<option value="10">10</option>

				<option value="20">20</option>

				<option value="50">50</option>

				<option value="100">100</option>

			</select>

			<span id="totalCountByStorCan" >条，共${totalCount}条</span>

		</div>

		<div callback='getStorageCancel' id="paginationByStorageCancel" rel="StorageCance" class="pagination" targetType="navTab" totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

	</div>
	<div class="formBar">
			
			<ul>
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button id="subTask" onclick="return validateCheckBoxSC()" type="submit">撤销</button></div></div>
				</li>
				
			</ul>
	</div>
</div>
</form>

	



